<% layout('/layouts/default.html', {title: '数据管理', libs:
['validate','fileupload','ueditor','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(ztQuan.isNewRecord ? '新增优惠券' :
				'编辑优惠券')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool"
					data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>
			</div>
		</div>

		<#form:form id="inputForm" model="${ztQuan}"
		action="${ctx}/ztQuan/save" method="post" class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('优惠券信息')}</div>
			<#form:hidden path="id"/>
			
			<div class="row">
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('优惠券名')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="name"
							maxlength="200" class="form-control required "/></div>
					</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('优惠券面额')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="price"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="200" class="form-control required"/></div>
					</div>
				</div>



			</div>

			<div class="row">
			<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('优惠券类型')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:select path="type" 
							dictType="zt_quan_type" blankOption="true" class="form-control required"
							/></div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							${text('剩余数量')}：<i class="fa icon-question hide"></i>
						</label>
						<div class="col-sm-8"><#form:input path="overCount"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="30" class="form-control " /></div>
					</div>
				</div>
			</div>

			<div class="row">


				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required ">*</span> ${text('已领取数量')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"> <#form:input path="total"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="30" class="form-control required"
							disabled="disabled"/> </div>
					</div>
				</div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required ">*</span> ${text('已使用数量')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"> <#form:input path="usetotal"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="30" class="form-control required"
							disabled="disabled"/> </div>
					</div>
				</div>

				
			</div>




			<div class="row">
				<!-- <div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('满额额度值')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:input path="edu"
							onkeyup="this.value=this.value.replace(/[^0-9-.-]+/,'');"
							maxlength="200" class="form-control required"/> <span>优惠券满多少可以使用；0表示没有购物额度限制</span>
						</div>

					</div>
				</div> -->
				<div class="col-xs-6">
				<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('发券人范围')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-4"><#form:select path="levelRange" 
							dictType="zt_levelRange_type" blankOption="true" class="form-control required"
							/></div>
				</div>
				</div>
				
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('状态')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:radio path="usestatus"
							dictType="zt_usestatus_type" class="form-control" /></div>
					</div>
				</div>

			</div>





			<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('创建时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="createDate" readonly="true" maxlength="20" class="form-control Wdate"
									dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('到期时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="toTime" readonly="true" maxlength="20" class="form-control Wdate"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
							</div>
						</div>
					</div>
				</div>

			
			<div class="row">
			<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required">*</span> ${text('是否限量')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:select path="islimit" 
							dictType="sys_limit_type" blankOption="true" class="form-control required"
							/></div>
					</div>
				</div>
			</div>				

			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('图片上传')}：</label>
						<div class="col-sm-10">
						
						
							
							<#form:fileupload id="upload2" returnPath="true"
	filePathInputId="img"  bizKey="${ztQuan.id}" bizType="user_upload2"
	uploadType="image" readonly="false" maxUploadNum="1" isMini="false"/>
	<#form:input name="img" class="form-control"/>
	
							</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title=""> <span
							class="required hide">*</span> ${text('优惠券简述')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-10"><#form:textarea path="remarks"
							rows="4" maxlength="200" class="form-control"/></div>
					</div>
				</div>
			</div>

		</div>
		<div class="box-footer">
			<div class="row">
				<div class="col-sm-offset-2 col-sm-10">
					<% if (hasPermi('ztGoods:ztGoodsData:edit')){ %>
					<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit">
						<i class="fa fa-check"></i> ${text('保 存')}
					</button>
					&nbsp; <% } %>
					<button type="button" class="btn btn-sm btn-default" id="btnCancel"
						onclick="js.closeCurrentTabPage()">
						<i class="fa fa-reply-all"></i> ${text('关 闭')}
					</button>
				</div>
			</div>
		</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
	$("#inputForm").validate({
		submitHandler : function(form) {
			js.ajaxSubmitForm($(form), function(data) {
				js.showMessage(data.message);
				if (data.result == Global.TRUE) {
					js.closeCurrentTabPage(function(contentWindow) {
						contentWindow.page();
					});
				}
			}, "json");
		}
	});
</script>